Using Custom Functions With .NET RESTful
The RESTful Report Engine (the Engine) ships with many functions, however, you may find from time to time you require a function customized to your needs that does not exist in our library. The Engine allows you to define your own custom macro functions to expand the Fluent reporting functionality.
In this article, we'll work step by step through a custom function example that you can download from here. We'll create a function "LOG(n)", which returns the common logarithm of its argument n.
note
Starting in Version 21, auto-loading of WindwardCustomFunctions.dll is no longer available you will have to manually activate WindwardCustomFunctions.dll by following the updated instructions below
#
Create the Custom FunctionUnzip CSCustomFunctionWalkthrough.zip then open the WindwardCustomFunctions.sln in Visual Studio. In the Visual Studio Solution Explorer, select the file WindwardCustomFunctions.cs:
Paste this code after the MULTIPLYALL
method in the WindwardCustomFunctions
class:
Finally, click on Build, then select Rebuild Solution:
A notification in the Output pane indicates the build was successful. The build produced a DLL called WindwardCustomFunctions.dll.
To find the new WindwardCustomFunctions.dll file, in Solution Explorer right-click on the project, then select Open Folder in File Explorer:
In File Explorer navigate to WindwardCustomFunctions\bin\Debug\
, and there is your new WindwardCustomFunctions.dll. Note this location for the custom function installation steps below:
#
Installing the Custom Function for the RESTful Engine- In File Explorer navigate to the directory where your WindwardCustomFunctions.dll file is located (as shown above):
%USERPROFILE%\Downloads\CSCustomFunctionWalkthrough\WindwardCustomFunctions\bin\Debug
- Copy the file WindwardCustomFunctions.dll.
- Next navigate to the install directory of the RESTful Engine, by default:
C:\inetpub\wwwroot\RESTfulEngine\bin
- Paste your WindwardCustomFunctions.dll into this directory.
Starting In Version 21 also follow these steps
- Open
C:\inetpub\wwwroot\RESTfulEngine\web.config
- Add the following under the
<WindwardReports>
in yourweb.config
file:
- Save the
web.config
note
To see how to install the custom functions in our Fluent Designer, please follow the instructions here <!---need link to custom function setup in designer --->